<div class="animated fadeIn">

  <div class="row">

    <div class="form-group col-md-3" style="padding-left: 5px">

      <select name="select" class="form-control" [(ngModel)]="saveData.key">
        <option value="1">新闻标题</option>
        <option value="2">企业名称</option>
      </select>

    </div>

    <div class="form-group col-md-3" style="padding-left: 5px">
      <input type="text" class="form-control input-down btn-radius" name="number" [(ngModel)]="saveData.keywords">
    </div>

    <!--查询-->
    <div class="form-group col-md-4" style="padding-left:5px">
      <button type="button" class="btn btn-primary btn-radius" (click)="getNewsSearch()">查询</button>
      <button type="button" class="btn btn-success btn-radius" [routerLink]="['add']">新增</button>
    </div>


    <!--查询-->

  </div>

  <div class="table-responsive" style="margin-top: 20px;overflow: auto">
    <table class="table table-center table-bordered table-hover" style="min-width: 0px">
      <thead class="table-inverse">
      <tr class="text-nowrap">
        <td>序号</td>
        <td>企业</td>
        <td>新闻标题</td>
        <td>封面</td>
        <td>类别</td>
        <td>状态</td>
        <td>发布时间</td>
        <td>添加时间</td>
        <td>操作</td>
      </tr>
      </thead>
      <tbody class="tab-content text-nowrap">
        <tr *ngFor="let item of news let i = index">
          <td>{{i+1}}</td>
          <td>{{item.enterprise}}</td>
          <td>{{item.title}}</td>
          <td><img style="width: 200px" src="{{imgUrl + item.cover}}"></td>
          <td>
            <span *ngIf="item.type == 1">品牌快讯</span>
            <span *ngIf="item.type == 2">网站动态</span>
            <span *ngIf="item.type == 3">线下活动</span>
            <span *ngIf="item.type == 4">媒体报道</span>
          </td>
          <td>
            <span *ngIf="item.shelves == 1">上架</span>
            <span *ngIf="item.shelves == 2">下架</span>
          </td>
          <td>{{item.releaseTime ? (item.releaseTime*1000 | date: 'yyyy-MM-dd HH:mm:ss') : '暂无'}}</td>
          <td>{{item.addTime*1000 | date: 'yyyy-MM-dd HH:mm:ss'}}</td>
          <td>
            <a href="javascript:;" [routerLink]="['detail',item]">查看</a>
            <a href="javascript:;" style="padding-left: 10px" *ngIf="item.shelves == 2" [routerLink]="['edit',{id:item.id,name:item.enterprise}]">编辑</a>
            <!---->
            <span class="removeBtn" *ngIf="item.shelves == 2"  style="padding-left: 10px" href="javascript:;"(click)="smallModal.show();deleteitem(item.id, 2)" >删除</span>
            <a href="javascript:;" style="padding-left: 10px" (click)="smallModal.show();clickShelves(item.id, item.shelves, 1)">
              <span *ngIf="item.shelves == 2">上架</span>
              <span *ngIf="item.shelves == 1">下架</span>
            </a>
          </td>
        </tr>
      </tbody>
    </table>
    <p class="noneData" *ngIf="!news.length">暂无数据</p>
    <!--分页组件-->
    <div style="float: right">
      <pagination [boundaryLinks]="true" [totalItems]="totalItems" [(ngModel)]="currentPage" itemsPerPage="10" [maxSize]="maxSize" previousText="上一页" nextText="下一页" firstText="首页" lastText="末页" (pageChanged)="pageChanged($event)"></pagination>
    </div>
  </div>
</div>


<div bsModal #smallModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-primary modal-sm" >
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">提示</h5>
        <button type="button" class="close" (click)="smallModal.hide()" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body" style="text-align: center" >
        <p style="margin: 0px" >{{modalText}}</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" (click)="smallModal.hide()">取消</button>
        <button  (click)="smallModal.hide()" type="button" class="btn btn-primary"   (click)="smallModal.hide(); definiteRequest();" >确定</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div>

